home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MacApp Documentation / MacApp AppleLink Messages / MacApp.Tech$ Oct 89 / Z0038-object type coercio-Oct89 < prev    next >
Encoding:
Text File  |  1989-10-10  |  1.0 KB  |  38 lines  |  [TEXT/GEOL]

  1. Item    6794167                         10-Oct-89        15:45
  2.  
  3. From:   ROTH2                           Roth, Eric
  4.  
  5. To:     MACAPP.TECH$                    MACAPP Tech
  6.  
  7. Sub:    object type coercion
  8.  
  9. I think this is an easy one:
  10.  
  11. I want to subclass TPopup to have some extra behavior.  The Demo Dialogs
  12. example contains the following code:
  13.  
  14.     VAR     aPopup:    TPopup;
  15.     ...
  16.     aPopup := TPopup(DoCreateViews(NIL, aDialogView, cPopupExample, gZeroVPt));
  17.  
  18.  
  19. which works fine.  When I create
  20.  
  21.     TMyPopup   = OBJECT (TPopup)
  22.  
  23. and then
  24.  
  25.     Var     aMyPopup:   TMyPopup;
  26.     ...
  27.     aMyPopup := TMyPopup(DoCreateViews(...));
  28.  
  29. I get an object type coercion error.  'DoCreateViews' returns a TView.  TPopup
  30. is a TControl which is a TView.  How is the coercion from a TView to a TMyPopup
  31. different from the first assignment, coercing from TView to TPopup?  (Don't
  32. tell me it's one level too many....)  Is there something about the resource
  33. definition of the popup view that has to match up with the new subclass?
  34.  
  35. Thanks is advance,
  36. Eric
  37.  
  38.